public class test2 {
    class Solution {
        public boolean isIsomorphic(String s, String t) {
            HashMap<Character,Character> s2t = new HashMap<>();
            HashMap<Character,Character> t2s = new HashMap<>();
            int len = s.length();
            for(int i = 0;i<len;i++){
                char x = s.charAt(i);
                char y = t.charAt(i);
                if(s2t.containsKey(x) && s2t.get(x)!=y || t2s.containsKey(y) && t2s.get(y)!=x){
                    return false;
                }
                s2t.put(x,y);
                t2s.put(y,x);
            }
            return true;
        }
    }
}
